home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Multimedia Toolkit
/
Multimedia Toolkit.iso
/
pascal
/
devdac.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-12-04
|
6KB
|
216 lines
{****************************************************************************}
{ }
{ MODULE: DevDac }
{ }
{ DESCRIPTION: Device driver for all DAC-type sound cards. This includes }
{ Uses timer polling. }
{ }
{ AUTHOR: Juan Carlos Arévalo }
{ }
{ MODIFICATIONS: Nobody (yet ;-) }
{ }
{ HISTORY: 12-Nov-1992 Documentation. }
{ }
{ (C) 1992 VangeliSTeam }
{____________________________________________________________________________}
UNIT DevDAC;
INTERFACE
CONST { Device ID Strings. }
DACDevID = 'DAC-Mono';
DAC2DevID = 'DAC-Stereo';
MixDAC2DevID = 'Mix-DAC-Stereo';
Mix2DAC2DevID = 'Mix2-DAC-Stereo';
{ Configuration. }
CONST
DacPort : WORD = $378;
LDacPort : WORD = $378;
RDacPort : WORD = $378;
IMPLEMENTATION
USES SoundDevices, StrConst;
{$L DEVDAC} { Assembler IRQs. }
PROCEDURE DACIntHandler; FAR; EXTERNAL;
PROCEDURE DAC2IntHandler; FAR; EXTERNAL;
PROCEDURE MixDAC2IntHandler; FAR; EXTERNAL;
PROCEDURE Mix2DAC2IntHandler; FAR; EXTERNAL;
{----------------------------------------------------------------------------}
{ Name functions. }
{____________________________________________________________________________}
FUNCTION DACName : TDevName; FAR;
BEGIN
DACName := GetString(StrDevDACName);
END;
FUNCTION DAC2Name : TDevName; FAR;
BEGIN
DAC2Name := GetString(StrDevDAC2Name);
END;
FUNCTION MixDAC2Name : TDevName; FAR;
BEGIN
MixDAC2Name := GetString(StrDevMixDAC2Name);
END;
FUNCTION Mix2DAC2Name : TDevName; FAR;
BEGIN
Mix2DAC2Name := GetString(StrDevMix2DAC2Name);
END;
{----------------------------------------------------------------------------}
{ Autodetect routine. It's always present (can't be detected). }
{____________________________________________________________________________}
FUNCTION DACDetect : BOOLEAN; FAR;
BEGIN
DACDetect := TRUE;
END;
{----------------------------------------------------------------------------}
{ Device Initialisation routine. }
{____________________________________________________________________________}
PROCEDURE Init(Hz: WORD); FAR;
BEGIN
CalcTimerData(Hz); { Standard polling initialisation. }
InitTimer;
END;
{----------------------------------------------------------------------------}
{ Device deinitialisation routine. }
{____________________________________________________________________________}
PROCEDURE DevEnd; FAR; ASSEMBLER;
ASM
END;
{----------------------------------------------------------------------------}
{ Accesory routines. }
{____________________________________________________________________________}
PROCEDURE DevChgHz(Hz: WORD); FAR;
BEGIN
CalcTimerData(Hz);
InitTimer;
END;
PROCEDURE DevPoll; FAR;
BEGIN
END;
{----------------------------------------------------------------------------}
{ Device records. }
{____________________________________________________________________________}
CONST
DACData : TSoundDevice = (
DevID : DACDevID;
DMA : FALSE
);
DAC2Data : TSoundDevice = (
DevID : DAC2DevID;
DMA : FALSE
);
MixDAC2Data : TSoundDevice = (
DevID : MixDAC2DevID;
DMA : FALSE
);
Mix2DAC2Data : TSoundDevice = (
DevID : Mix2DAC2DevID;
DMA : FALSE
);
{----------------------------------------------------------------------------}
{ Init code. }
{____________________________________________________________________________}
BEGIN
WITH DACData DO BEGIN
Name := DACName;
AutoDetect := DACDetect;
InitRut := Init;
ChgHzProc := DevChgHz;
GetRealFreqProc := GetRealFreq;
TimerHandler := DACIntHandler;
PollRut := DevPoll;
EndRut := DevEnd;
END;
WITH DAC2Data DO BEGIN
Name := DAC2Name;
AutoDetect := DACDetect;
InitRut := Init;
ChgHzProc := DevChgHz;
GetRealFreqProc := GetRealFreq;
TimerHandler := DAC2IntHandler;
PollRut := DevPoll;
EndRut := DevEnd;
END;
WITH MixDAC2Data DO BEGIN
Name := MixDAC2Name;
AutoDetect := DACDetect;
InitRut := Init;
ChgHzProc := DevChgHz;
GetRealFreqProc := GetRealFreq;
TimerHandler := MixDAC2IntHandler;
PollRut := DevPoll;
EndRut := DevEnd;
END;
WITH Mix2DAC2Data DO BEGIN
Name := Mix2DAC2Name;
AutoDetect := DACDetect;
InitRut := Init;
ChgHzProc := DevChgHz;
GetRealFreqProc := GetRealFreq;
TimerHandler := Mix2DAC2IntHandler;
PollRut := DevPoll;
EndRut := DevEnd;
END;
InitDevice(@Mix2DAC2Data);
InitDevice(@MixDAC2Data);
InitDevice(@DAC2Data);
InitDevice(@DACData);
END.